package com.zhongc.advance.common.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 *                       
 * @Filename SourceSystem.java
 *
 * @Description 注册来源
 *
 * @Version 1.0
 *
 * @Author liuyonglin
 *
 * @Email liuyonglin_soul@163.com
 *       
 * @History
 *<li>Author: liuyonglin</li>
 *<li>Date: 2015-6-2</li>
 *<li>Version: 1.0</li>
 *<li>Content: create</li>
 *
 */
public enum SourceSystem implements Messageable{
	
    /** 电商*/
    EARTH("earth","电商"),
    /** 物业*/
    COMPUTER("cumputer","电脑"),
    /** 后台 */
    BOSS("boss", "后台"),
    /** 移动 */
    MOBILE("mobile", "移动");
    
    /** 枚举值 */
    private final String	code;

    /** 枚举描述 */
    private final String	message;

    /**
     * 构造一个<code>RegisterFromEnum</code>枚举对象
     *
     * @param code
     * @param message
     */
    private SourceSystem(String code, String message) {
        this.code = code;
        this.message = message;
    }

    /**
     * @return Returns the code.
     */
    public String getCode() {
        return code;
    }

    /**
     * @return Returns the message.
     */
    public String getMessage() {
        return message;
    }

    /**
     * @return Returns the code.
     */
    public String code() {
        return code;
    }

    /**
     * @return Returns the message.
     */
    public String message() {
        return message;
    }

    /**
     * 通过枚举<code>code</code>获得枚举
     *
     * @param code
     * @return RegisterFromEnum
     */
    public static SourceSystem getByCode(String code) {
        for (SourceSystem _enum : values()) {
            if (_enum.getCode().equals(code)) {
                return _enum;
            }
        }
        return null;
    }

    /**
     * 获取全部枚举
     *
     * @return List<RegisterFromEnum>
     */
    public List<SourceSystem> getAllEnum() {
        List<SourceSystem> list = new ArrayList<SourceSystem>();
        for (SourceSystem _enum : values()) {
            list.add(_enum);
        }
        return list;
    }

    /**
     * 获取全部枚举值
     *
     * @return List<String>
     */
    public List<String> getAllEnumCode() {
        List<String> list = new ArrayList<String>();
        for (SourceSystem _enum : values()) {
            list.add(_enum.code());
        }
        return list;
    }
}
